﻿Imports Entities
Imports DataAccess
Public Class BoletaBL
    Public Shared Function Save(ByVal zobject As BOLETAS) As BOLETAS
        If zobject.BOLETA > 0 Then
            Return BoletaDAL.Update(zobject)
        Else
            Return BoletaDAL.Create(zobject)
        End If

    End Function

    
    Public Shared Function Delete(ByVal zBoletaId As Long) As Boolean
        Return BoletaDAL.Delete(zBoletaId)
    End Function

   

    Public Shared Function List() As List(Of BOLETAS)
        Dim lista As New List(Of BOLETAS)
        lista = BoletaDAL.List
        If lista.Count > 0 Then
            Return lista
        Else
            Return Nothing
        End If
    End Function

    Public Shared Function SearchById(ByVal zId As Long) As BOLETAS
        Dim bol As New BOLETAS
        bol = BoletaDAL.SearchById(zId)
        Return bol
    End Function
   
   
    Public Shared Function GetNextBoleta() As Long
        Dim bol As New BOLETAS
        bol = BoletaDAL.GetLast
        If Not IsNothing(bol) Then
            Return bol.BOLETA + 1
        Else
            Return 0
        End If
    End Function

  
End Class
